package com.itheima.inetaddress;

import java.io.IOException;
import java.net.*;

public class Demo06 {
    public static void main(String[] args) throws IOException {
        //创建码头
        DatagramSocket ds = new DatagramSocket();

        String s = "hello 组播";
        byte[] bytes = s.getBytes();
        InetAddress byName = InetAddress.getByName("224.0.1.0");
        int port = 10000;
        //创建箱子
        DatagramPacket dp = new DatagramPacket(bytes,bytes.length,byName,port);

        //发送数据
        ds.send(dp);

        //释放资源
        ds.close();
    }
}
